feat(mcp): add OIDC auth, HTTP entry point, and Dockerfile for hosted deployment#1046
Conversation
… deployment - Add OIDCProxy auth to MCP server (env-var gated, no OIDC = unchanged behavior) - Add /health endpoint for load balancer probes - Add airbyte/mcp/http_main.py HTTP entry point module - Add airbyte-mcp-http script entry point in pyproject.toml - Add Dockerfile.mcp for containerized MCP deployment Co-Authored-By: AJ Steers <aj@airbyte.io>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This PyAirbyte VersionYou can test this version of PyAirbyte using the following: # Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1781654305-hosted-cloud-mcp' pyairbyte --help
# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1781654305-hosted-cloud-mcp'PR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful ResourcesCommunity SupportQuestions? Join the #pyairbyte channel in our Slack workspace. |
starlette is a transitive dependency of fastmcp, imported directly for custom_route handler type signatures (Request, JSONResponse). Co-Authored-By: AJ Steers <aj@airbyte.io>
📝 WalkthroughWalkthroughAdds HTTP transport support to the Airbyte MCP server. A new ChangesMCP HTTP Transport, OIDC Auth, and Docker Packaging
Sequence Diagram(s)sequenceDiagram
participant Client
participant OIDCProxy
participant FastMCPApp
participant HealthRoute
Client->>OIDCProxy: HTTP request (if OIDC configured)
OIDCProxy->>FastMCPApp: Validated request forwarded
Client->>FastMCPApp: GET /health (unauthenticated)
FastMCPApp->>HealthRoute: Route dispatched
HealthRoute-->>Client: JSONResponse {"status": "ok"}
Client->>FastMCPApp: MCP streamable-http transport request
FastMCPApp-->>Client: MCP response (stateless)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Coverage OverviewLanguages: Python Python / code-coverage/pytest-fastThe overall coverage in the branch is 67%. The coverage in the branch is 65%. Show a code coverage summary of the most impacted files.
Python / code-coverage/pytest-no-credsThe overall coverage in the branch is 67%. The coverage in the branch is 65%. Show a code coverage summary of the most impacted files.
Python / code-coverage/pytestThe overall coverage in the branch is 72%. The coverage in the branch is 71%. Show a code coverage summary of the most impacted files.
Updated |
…user - Merge MCP_HTTP_HOST/PORT into defaults (0.0.0.0:8080), MCP_SERVER_URL is the only URL config needed - Add client_id to OIDC validation - Declare starlette as direct dependency instead of deptry ignore - Add non-root user (UID 10001) to Dockerfile.mcp - Remove os import from http_main (uses server constants directly) Co-Authored-By: AJ Steers <aj@airbyte.io>
There was a problem hiding this comment.
Pull request overview
Adds hosted-deployment support for the PyAirbyte MCP server by introducing an HTTP entry point, optional OIDC auth wiring, and a container build setup suitable for Cloud Run–style platforms.
Changes:
- Add optional Keycloak OIDC authentication via
OIDCProxyand a/healthendpoint on the MCP server app. - Introduce an HTTP transport entry point (
airbyte-mcp-http) to run the MCP server overstreamable-http. - Add a dedicated Dockerfile for building and running the HTTP MCP server container.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Adds starlette to the resolved dependency set. |
pyproject.toml |
Declares starlette as a direct dependency and registers the airbyte-mcp-http script entry point. |
Dockerfile.mcp |
Builds a minimal container image that runs airbyte-mcp-http on port 8080 as a non-root user. |
airbyte/mcp/server.py |
Adds OIDC auth provider creation, HTTP defaults, and a /health route on the server app. |
airbyte/mcp/http_main.py |
Adds a new CLI entry point to run the MCP server using streamable-http. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: AJ Steers <aj@airbyte.io>
Summary
Adds hosted HTTP deployment support for the PyAirbyte (Cloud/Replication) MCP server with optional Keycloak OIDC auth, matching the pattern from airbytehq/airbyte-ops-mcp#931.
Server:
_create_oidc_auth()returnsOIDCProxywhen all three OIDC env vars are set (OIDC_CONFIG_URL,OIDC_CLIENT_ID,OIDC_CLIENT_SECRET),Noneotherwise./healthendpoint for LB probes. Defaults:DEFAULT_HTTP_HOST = "0.0.0.0",DEFAULT_HTTP_PORT = 8080.Entry point: New
airbyte/mcp/http_main.py— imports constants fromserver.py, runsapp.run(transport="streamable-http", stateless_http=True). Registered asairbyte-mcp-httpconsole script.Container: Multi-stage
Dockerfile.mcpwith non-rootappuser(UID 10001), entry pointairbyte-mcp-http, port 8080.Dependencies:
starletteadded as direct dependency (was transitive via fastmcp, flagged by deptry DEP003).The existing
mcp-serve-httppoe task retains its local-dev config (127.0.0.1:8000,httptransport) — intentionally different from the production entry point.Link to Devin session: https://app.devin.ai/sessions/275fbaf2f101462e8c34c5d0fcff792d
Requested by: Aaron ("AJ") Steers (@aaronsteers)